<?php
class MessageControl extends BaseControl
{
	public function Render()
	{
        $flash = array();
        $out = array();
        if ($msg = MessageBase::GetConfirmMsg())
        {
            $m = new MessageConfirm($msg);
            $flash[] = $m->Render();
        }
        if ($msg = MessageBase::GetWarningMsg())
        {
            $m = new MessageWarning($msg);
            $flash[] = $m->Render();
        }
        if ($msg = MessageBase::GetInfoMsg())
        {
            $m = new MessageInfo($msg);
            $flash[] = $m->Render();
        }
        MessageBase::ClearMessage();
        foreach ($flash as $f)
        {
            $out[] = '<div class="messagebox '.$f['status'].'" style="'.$f['display'].'">'.$f['msg'].'</div>';
        }
        return implode(null, $out);
	}

    public static function Flash()
	{
		$m = new MessageControl();
		return $m->Render();
	}
}
?>
